import logging
from datetime import datetime

from formencode.validators import Int

from clutch import Controller, expose, validate
from clutch import exceptions as exc
from clutch import api

from testapplication import model as m

log = logging.getLogger(__name__)

class Root(Controller):

    @expose('index.html')
    def index(self):
        return dict(now=datetime.now())

    def _on_404(self, *args, **kwargs):
        raise exc.ContinueTraversal(SimpleDynamic(args[0]), args[1:])

class SimpleDynamic(Controller):

    def __init__(self, value):
        self.value = value

    @expose()
    def index(self):
        return 'Hello, %s' % self.value
